package com.neusoft.resturant.service.impl;

import com.neusoft.resturant.common.utils.DateUtils;
import com.neusoft.resturant.entity.ResDishes;
import com.neusoft.resturant.mapper.ResDishesMapper;
import com.neusoft.resturant.service.IResDishesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 菜品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-10
 */
@Service
public class ResDishesServiceImpl implements IResDishesService
{
    @Autowired
    private ResDishesMapper ResDishesMapper;

    /**
     * 查询菜品
     * 
     * @param id 菜品主键
     * @return 菜品
     */
    @Override
    public ResDishes selectResDishesById(Long id)
    {
        return ResDishesMapper.selectResDishesById(id);
    }

    /**
     * 查询菜品列表
     * 
     * @param ResDishes 菜品
     * @return 菜品
     */
    @Override
    public List<ResDishes> selectResDishesList(ResDishes ResDishes)
    {
        return ResDishesMapper.selectResDishesList(ResDishes);
    }

    /**
     * 新增菜品
     * 
     * @param ResDishes 菜品
     * @return 结果
     */
    @Override
    public int insertResDishes(ResDishes ResDishes)
    {
        ResDishes.setCreateTime(DateUtils.getNowDate());
        return ResDishesMapper.insertResDishes(ResDishes);
    }

    /**
     * 修改菜品
     * 
     * @param ResDishes 菜品
     * @return 结果
     */
    @Override
    public int updateResDishes(ResDishes ResDishes)
    {
        ResDishes.setUpdateTime(DateUtils.getNowDate());
        return ResDishesMapper.updateResDishes(ResDishes);
    }

    /**
     * 批量删除菜品
     * 
     * @param ids 需要删除的菜品主键
     * @return 结果
     */
    /*
    @Override
    public int deleteResDishesByIds(Long[] ids)
    {
        return ResDishesMapper.deleteResDishesByIds(ids);
    }
    */
    /**
     * 删除菜品信息
     * 
     * @param id 菜品主键
     * @return 结果
     */
    @Override
    public int deleteResDishesById(Long id)
    {
        return ResDishesMapper.deleteResDishesById(id);
    }
}
